
var PasswordMy = {
	view: function (id) {
		var url = "my.php?do=Profile.base";		
		_dialog_view(url, '我的基本信息', '500x310');
	},
	
	edit: function (type, title) {
		$('#dialog_edit').dialog('option', 'buttons', {	
			"关闭": function() {
				$(this).dialog("close");
			},
	
			"修改": function() {
				var form = $("#form_edit")[0];
	
				var body = {};
				body.type = form.type.value;
				body.p1 = form.p1.value;
				body.p2 = form.p2.value;
				body.p3 = form.p3.value;
				
				if (body.p2 == '' || body.p3 == '') {
					alert("密码不能为空，请重新输入！");
					return;
				}
				
				if (body.p2 != body.p3) {
					alert("新密码有误，请重新输入！");
					return;
				}			
				
				if (!confirm("确认是否提交？")) {
					return false;
				}
				
				$(this).dialog("close");
	
				var url = 'emp.php?do=PasswordMy.editPost';					
				$.getJSON(url, body, function(json) {
					if (json.status == 1) {
						alert("密码修改成功！");
					}
					
					if (json.status == 2) {
						alert("旧密码不对，修改失败！");
					}
				});
			}
		});
	
		var url = "emp.php?do=PasswordMy.edit&type=" + type;
		dialog_edit(url, title, '550x350');
	}
};